package com.ben.multiple.aop.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * EnableAsync:开启异步任务
 */
@Configuration
@ConditionalOnWebApplication
@EnableAsync
public class LogAutoConfig {

    @Bean
    public SpringContextHolder springContextHolder() {
        return new SpringContextHolder();
    }

    @Bean
    public LogListener sysLogListener(LogResource logResource) {
        return new LogListener(logResource);
    }

    @Bean
    public LogAspect sysLogAspect() {
        return new LogAspect();
    }
}
